home *** CD-ROM | disk | FTP | other *** search
-
- ;*========================================================================
- ;*
- ;* AESFAST Public Domain GEM bindings.
- ;*
- ;*========================================================================
-
- ;*************************************************************************
- ;*
- ;* AESUTRC5.S - Rectangle utilities 5
- ;* Utility routines involving non-standard rectangle calcs...
- ;*
- ;*************************************************************************
-
- ;-------------------------------------------------------------------------
- ;
- ; rc_gadjust - Adjust a GRECT rectangle.
- ; rc_vadjust - Adjust a VRECT rectangle.
- ;
- ; These functions will expand or contract a rectangle
- ; (GRECT = rc_gadjust or VRECT = rc_vadjust) by a given
- ; size in each axis.
- ;
- ; A positive adjustment expands the area, and a negative
- ; adjustment shrinks it.
- ;
- ; void rc_Xadjust(&rect, horiz_adjust, vert_adjust);
- ;-------------------------------------------------------------------------
-
- _rc_gadjust::
-
- moveq.l #1,d2 ; Set GRECT-flag.
- bra.s adjust ; Continue below.
-
- _rc_vadjust::
-
- moveq.l #0,d2 ; Clear GRECT-flag.
-
- adjust: ; Common code...
-
- .cargs #4,.prect.l,.hadj,.vadj
-
- move.l .prect(sp),a0 ; Get rectangle pointer.
- move.w .hadj(sp),d0 ; Get x-axis adjustment.
- move.w .vadj(sp),d1 ; Get y-axis adjustment.
-
- sub.w d0,(a0) ; Adjust g_x (or v_x1).
- bpl.s .notneg1 ; If adjusted value is negative,
- clr.w (a0) ; force it back to zero.
- .notneg1:
- addq.l #2,a0
- sub.w d1,(a0) ; Adjust g_y (or v_y1).
- bpl.s .notneg2 ; If adjusted value is negative,
- clr.w (a0) ; force it back to zero.
- .notneg2:
- addq.l #2,a0
-
- tst.w d2 ; Test GRECT flag.
- beq.s .no_double ; Skip doubling if VRECT.
-
- add.w d0,d0 ; For GRECTs we have to double the
- add.w d1,d1 ; adjustment to width & height.
- .no_double:
- add.w d0,(a0) ; Adjust g_w (or v_x2).
- bpl.s .notneg3 ; If adjusted value is negative,
- clr.w (a0) ; force it back to zero.
- .notneg3:
- addq.l #2,a0
- add.w d1,(a0) ; Adjust g_h (or v_y2).
- bpl.s .notneg4 ; If adjusted value is negative,
- clr.w (a0) ; force it back to zero.
- .notneg4:
- rts ; Return.
-
- ; end of code
-
-